﻿Imports iConverter.Contracts
Imports System.Drawing
Imports System.Configuration


''' <summary>
''' 后期处理插件基类
''' </summary>
''' <typeparam name="TSettings">用于保存插件设置的强类型</typeparam>
''' <remarks></remarks>
Public MustInherit Class PostProcessing(Of TSettings As ApplicationSettingsBase)
    Inherits Plugin(Of TSettings)
    Implements IPostProcessing, IPostProcessingMetadata 






    ''' <summary>
    ''' 创建新的实例
    ''' </summary>
    ''' <param name="provider">插件提供器</param>
    ''' <param name="id">ID</param>
    ''' <param name="name">名称</param>
    ''' <param name="description">描述</param>
    ''' <param name="lIcon">大图标（32 X 32）</param>
    ''' <param name="sIcon">小图标（16 x 16）</param>
    ''' <remarks></remarks>
    Sub New(ByRef provider As PluginProvider(Of TSettings),
            ByVal id As Guid,
            ByVal name As String,
            ByVal description As String,
            ByVal lIcon As Bitmap,
            ByVal sIcon As Bitmap)
        MyBase.New(PluginTypes.PostProcess,
                   id, name, description, lIcon, sIcon)

    End Sub


#Region "IPostProcessing  实现"

    ''' <summary>
    ''' 处理器列表
    ''' </summary>
    ''' <remarks></remarks>
    Dim _ProcessingList As List(Of Processor(Of TSettings))

    ''' <summary>
    ''' 获取用于后期处理的互斥操作方法组
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetProcessings() As System.Collections.Generic.IEnumerable(Of Contracts.IProcessing) Implements Contracts.IPostProcessing.GetProcessings
        If Me._ProcessingList Is Nothing Then
            Me._ProcessingList = GenerateProcessings()

            For Each item In Me._ProcessingList
                item.Provider = Me.Provider
            Next
        End If

        Return _ProcessingList
    End Function


    ''' <summary>
    ''' 生成处理器列表
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected MustOverride Function GenerateProcessings() As List(Of Processor(Of TSettings))



#End Region


End Class
